package com.jefe.service.model.impl;

import com.jefe.service.model.MessageTbl;
import com.jefe.service.model.MessageTblSoap;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;


/**
 * <a href="MessageTblModelImpl.java.html"><b><i>View Source</i></b></a>
 *
 * <p>
 * ServiceBuilder generated this class. Modifications in this class will be
 * overwritten the next time is generated.
 * </p>
 *
 * <p>
 * This class is a model that represents the <code>MessageTbl</code> table
 * in the database.
 * </p>
 *
 * @author Brian Wing Shun Chan
 *
 * @see com.jefe.service.model.MessageTbl
 * @see com.jefe.service.model.MessageTblModel
 * @see com.jefe.service.model.impl.MessageTblImpl
 *
 */
public class MessageTblModelImpl extends BaseModelImpl<MessageTbl> {
    public static final String TABLE_NAME = "MessageTbl";
    public static final Object[][] TABLE_COLUMNS = {
            { "shortName", new Integer(Types.VARCHAR) },
            

            { "heading", new Integer(Types.VARCHAR) },
            

            { "message", new Integer(Types.VARCHAR) },
            

            { "id", new Integer(Types.INTEGER) },
            

            { "image", new Integer(Types.VARCHAR) }
        };
    public static final String TABLE_SQL_CREATE = "create table MessageTbl (shortName VARCHAR(75) null,heading VARCHAR(75) null,message VARCHAR(75) null,id INTEGER not null primary key,image VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table MessageTbl";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.com.jefe.service.model.MessageTbl"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.com.jefe.service.model.MessageTbl"),
            true);
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.com.jefe.service.model.MessageTbl"));
    private String _shortName;
    private String _heading;
    private String _message;
    private int _id;
    private String _image;

    public MessageTblModelImpl() {
    }

    public static MessageTbl toModel(MessageTblSoap soapModel) {
        MessageTbl model = new MessageTblImpl();

        model.setShortName(soapModel.getShortName());
        model.setHeading(soapModel.getHeading());
        model.setMessage(soapModel.getMessage());
        model.setId(soapModel.getId());
        model.setImage(soapModel.getImage());

        return model;
    }

    public static List<MessageTbl> toModels(MessageTblSoap[] soapModels) {
        List<MessageTbl> models = new ArrayList<MessageTbl>(soapModels.length);

        for (MessageTblSoap soapModel : soapModels) {
            models.add(toModel(soapModel));
        }

        return models;
    }

    public int getPrimaryKey() {
        return _id;
    }

    public void setPrimaryKey(int pk) {
        setId(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Integer(_id);
    }

    public String getShortName() {
        return GetterUtil.getString(_shortName);
    }

    public void setShortName(String shortName) {
        _shortName = shortName;
    }

    public String getHeading() {
        return GetterUtil.getString(_heading);
    }

    public void setHeading(String heading) {
        _heading = heading;
    }

    public String getMessage() {
        return GetterUtil.getString(_message);
    }

    public void setMessage(String message) {
        _message = message;
    }

    public int getId() {
        return _id;
    }

    public void setId(int id) {
        _id = id;
    }

    public String getImage() {
        return GetterUtil.getString(_image);
    }

    public void setImage(String image) {
        _image = image;
    }

    public MessageTbl toEscapedModel() {
        if (isEscapedModel()) {
            return (MessageTbl) this;
        } else {
            MessageTbl model = new MessageTblImpl();

            model.setNew(isNew());
            model.setEscapedModel(true);

            model.setShortName(HtmlUtil.escape(getShortName()));
            model.setHeading(HtmlUtil.escape(getHeading()));
            model.setMessage(HtmlUtil.escape(getMessage()));
            model.setId(getId());
            model.setImage(HtmlUtil.escape(getImage()));

            model = (MessageTbl) Proxy.newProxyInstance(MessageTbl.class.getClassLoader(),
                    new Class[] { MessageTbl.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        MessageTblImpl clone = new MessageTblImpl();

        clone.setShortName(getShortName());
        clone.setHeading(getHeading());
        clone.setMessage(getMessage());
        clone.setId(getId());
        clone.setImage(getImage());

        return clone;
    }

    public int compareTo(MessageTbl messageTbl) {
        int pk = messageTbl.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        MessageTbl messageTbl = null;

        try {
            messageTbl = (MessageTbl) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        int pk = messageTbl.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{shortName=");
        sb.append(getShortName());
        sb.append(", heading=");
        sb.append(getHeading());
        sb.append(", message=");
        sb.append(getMessage());
        sb.append(", id=");
        sb.append(getId());
        sb.append(", image=");
        sb.append(getImage());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("com.jefe.service.model.MessageTbl");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>shortName</column-name><column-value><![CDATA[");
        sb.append(getShortName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>heading</column-name><column-value><![CDATA[");
        sb.append(getHeading());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>message</column-name><column-value><![CDATA[");
        sb.append(getMessage());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>id</column-name><column-value><![CDATA[");
        sb.append(getId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>image</column-name><column-value><![CDATA[");
        sb.append(getImage());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
